package com.gnetek.netty.contact;

import com.gnetek.netty.utils.IntBytesUtils;

/**
 * @Description 描述
 * @Author Darren Huang
 * @Date 2023-09-08 13:51
 */
public class SequenceFactory {

    private static final int MAX = 268435455;

    private static int sequence = 0;

    public static byte[] nextSequenceBytes() {
        return IntBytesUtils.int2Bytes4HL(nextSequence());
    }

    public static int nextSequence(){
        if(sequence>MAX){
            sequence = 0;
        }
        return ++sequence;
    }
}
